/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DATA.iDataSetParts;

import java.io.Serializable;
import java.util.Vector;

/**
 * 
 * @author Bunkowski
 */
public class Peak implements Serializable {

	public static final long serialVersionUID = 1L;// 5272056056617092231L;

	public double intensity, dt, rt, dtSize, rtSize, volume;
	private SubstanceInfo substance;

	// TODO Remove unused code found by UCDetector
	// public boolean highlight = false;

	public Peak(String[] parameter) {
		intensity = Double.parseDouble(parameter[0]);
		dt = Double.parseDouble(parameter[1]);
		rt = Double.parseDouble(parameter[2]);
		dtSize = Double.parseDouble(parameter[3]);
		rtSize = Double.parseDouble(parameter[4]);
		if (parameter.length > 5) {
			volume = Double.parseDouble(parameter[5].replace(",", "."));
		} else
			volume = 0;
	}

	public Vector<String> getParametersAsStringVector() {
		Vector<String> parameters = new Vector<String>();
		parameters.add(intensity + "");
		parameters.add(dt + "");
		parameters.add(rt + "");
		parameters.add(dtSize + "");
		parameters.add(rtSize + "");
		parameters.add(volume + "");
		return parameters;
	}

	public Vector<String> getParametersAsStringVectorWithSubstance() {
		Vector<String> parameters = new Vector<String>();
		if (substance != null)
			parameters.add(substance.name);
		else
			parameters.add("");
		parameters.add(intensity + "");
		parameters.add(dt + "");
		parameters.add(rt + "");
		parameters.add(dtSize + "");
		parameters.add(rtSize + "");
		return parameters;
	}

	public String toString() {
		String returnValue = "";

		returnValue = "ObjClass : " + this.getClass() + "\r\n";

		returnValue += "intensity : " + intensity + "\r\n";
		returnValue += "dt : " + dt + "\r\n";
		returnValue += "rt : " + rt + "\r\n";
		returnValue += "dtSize : " + dtSize + "\r\n";
		returnValue += "rtSize : " + rtSize + "\r\n";
		returnValue += "volume : " + volume + "\r\n";

		if (substance != null)
			returnValue += "substance : " + substance.ObjectToString() + "\r\n";

		else
			returnValue += "substance : " + "null" + "\r\n";
		returnValue += "volume : " + volume + "\r\n";
		returnValue += "EndObject";

		return returnValue;

	}

}